import argparse, numpy as np, pandas as pd
from scipy.spatial import cKDTree

def min_sep(df):
    xyz = np.vstack([df['x'],df['y'],df['z']]).T
    tree = cKDTree(xyz)
    d, _ = tree.query(xyz, k=2)
    return float(d[:,1].min())

if __name__ == "__main__":
    ap = argparse.ArgumentParser()
    ap.add_argument("--check", type=str, required=True)
    args = ap.parse_args()
    df = pd.read_csv(args.check)
    print("min separation (rad on unit sphere approx):", min_sep(df))
